home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Taifun
/
Taifun 080 (1988-11-15)(Ossowski, Stefan)(DE)(PD).zip
/
Taifun 080 (1988-11-15)(Ossowski, Stefan)(DE)(PD).adf
/
XBoot
/
XBoot.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-08-14
|
2KB
|
61 lines
/* Conversion of a boot-block in an executable */
/* Placed in Public Domain by Francois Rouaix in 1988 */
#include <libraries/dos.h>
char buffer[1024] ;
long header[12] = { 0x000003f3, /* Hunk_Header */
0x00000000, /* no hunk_name */
0x00000002, /* size of hunk_table */
0x00000000, /* first hunk */
0x00000001, /* last hunk */
0x000000fd, /* size of hunk 0 */
0x00000003, /* size of hunk 1 */
0x000003e9, /* hunk_code */
0x000000fd, /* size of hunk_code = 253 */
/* end of header */
0x000003ea, /* hunk_data */
0x00000003, /* size */
/* end of header */
0x000003f2
} ;
/* xboot infile outfile */
main(argc,argv)
int argc;
char *argv[];
{
struct FileHandle *infile=0,*outfile=0 ;
int b=0;
if (argc != 3) {
printf("Usage: %s infile outfile \n",argv[0]);
Exit(0);
}
if (!(infile = (struct FileHandle *)Open(argv[1],MODE_OLDFILE))) {
printf("Can't open %s\n",argv[1]);
Exit(0);
}
if (!(outfile = (struct FileHandle *)Open(argv[2],MODE_NEWFILE))) {
Close(infile);
printf("Can't open %s\n",argv[2]);
Exit(0);
}
b = Read(infile,&buffer[0],1024);
if (b != 1024) printf("Warning ! Bad File.\n");
Close(infile);
Write(outfile,(char *)&header[0],4*9); /* header */
Write(outfile,(char *)&buffer[12],4*253); /* code */
Write(outfile,(char *)&header[11],4); /* hunk_end */
Write(outfile,(char *)&header[9],4*2); /* header for data */
Write(outfile,(char *)&buffer[0],4*3); /* data */
Write(outfile,(char *)&header[11],4); /* hunk_end */
Close(outfile);
}